#ifndef MERCHANT_HPP_INCLUDED
#define MERCHANT_HPP_INCLUDED

#include <map>
#include <sstream>

#include "city_fwd.hpp"
#include "money_market.hpp"
#include "world.hpp"

const_item_type_ptr best_item_to_trade(const money_market& exporter, const money_market& importer, int* profit_margin);

struct merchant_trade {
	const_city_ptr from, to;
	const_item_type_ptr item;
	int moves_taken;
	int profit;

	//the path we take; owned by the city that it comes from.
	const std::vector<hex::location>* path;
};

std::ostream& operator<<(std::ostream& os, const merchant_trade& trade);


//function for a merchant to choose which city to trade goods to, and what
//goods to trade. 'nmoves' contains the number of moves the merchant has to
//make, and will be updated to contain the number the merchant has after the
//move.
bool merchant_choose_trade(const world& w, const_city_ptr from, int nmoves, merchant_trade& result);

int estimate_merchant_profits(const world& w, const_city_ptr from, int nmoves);

std::vector<merchant_trade> execute_merchant_trades(world& w);

#endif
